package zuwotest;

import java.util.ArrayList;
import java.util.List;

import org.junit.Test;

import cn.diancan.dto.PurchaseSaleOrderStatisticsDto;
import cn.diancan.dto.query.PurchaseSaleOrderProductQuery;
import cn.diancan.exception.OutMsgException;
import cn.diancan.model.types.PurchaseSaleOrderProductStatusType;
import cn.diancan.vo.model.PurchaseSaleOrderProductVo;
import cn.diancan.vo.other.Pager;

public class PurchaseSaleTest extends BaseTest{

    
    @Test
    public void t1(){
	try {
	    List<PurchaseSaleOrderProductVo>  productVoList = new ArrayList<PurchaseSaleOrderProductVo>();
	    productVoList.add(new PurchaseSaleOrderProductVo(143099l,326494l,null,2));
	    productVoList.add(new PurchaseSaleOrderProductVo(143098l,326495l,null,5));
	    
	    productVoList.add(new PurchaseSaleOrderProductVo(143255l,326497l,null,2));
	    
	    //PurchaseSaleOrder purchaseSaleOrder =  purchaseSaleOrderService.saveCreatePurchaseOrder(productVoList, "", "");
	    
	} catch (Exception e) {
	    // TODO Auto-generated catch block
	    e.printStackTrace();
	}
    }
    
    @Test
    public void t2(){
	try {
	    List<PurchaseSaleOrderProductVo>  productVoList = new ArrayList<PurchaseSaleOrderProductVo>();
	    //productVoList.add(new PurchaseSaleOrderProductVo(143099l,326494l,null,2));
	    //productVoList.add(new PurchaseSaleOrderProductVo(143099l,326495l,null,5));
	    //productVoList.add(new PurchaseSaleOrderProductVo(143255l,326497l,null,2));
	    productVoList.add(new PurchaseSaleOrderProductVo(143098l, 326494l, null, 2, PurchaseSaleOrderProductStatusType.GIFT.getType(), 1f, 168d, 332d, 332d));
	    productVoList.add(new PurchaseSaleOrderProductVo(143098l, 326494l, null, 2, PurchaseSaleOrderProductStatusType.SALE.getType(), 1f, 168d, 332d, 332d));
	    productVoList.add(new PurchaseSaleOrderProductVo(143098l, 326494l, null, 2, PurchaseSaleOrderProductStatusType.RETURNGOODS.getType(), 1f, 168d, 332d, 332d));
	    
	  
	    
	    
	    // PurchaseSaleOrder purchaseSaleOrder =  purchaseSaleOrderService.saveCreateSaleOrder(productVoList, "MJ1234", 0d, ""); 
	   
	   // PurchaseSaleOrder purchaseSaleOrder = purchaseSaleOrderService.saveCreateSaleOrder(productVoList, "MJ1234", 1, 0d, "", 0, DateUtil.currentDateTime(), 5l, 1);
	}   catch (Exception e) {
	    // TODO Auto-generated catch block
	    e.printStackTrace();
	}
    }
    
    @Test
    public void t3(){
	Pager pager =new Pager();
	try {
	    long sy=System.currentTimeMillis();
	    PurchaseSaleOrderProductQuery query = new PurchaseSaleOrderProductQuery();
	    PurchaseSaleOrderStatisticsDto statisticsDto  = new PurchaseSaleOrderStatisticsDto(); 
	    purchaseSaleOrderService.findPagerBySaleOrderProduct(pager,query,statisticsDto);
	    System.out.println(pager);
	    System.out.println(System.currentTimeMillis()-sy);
	} catch (OutMsgException e) { 
	    e.printStackTrace();
	} catch (Exception e) { 
	    e.printStackTrace();
	}
    }
    
    
    
}
